
import { PrismaClient } from '@prisma/client'
import { NextResponse } from 'next/server';

const prisma = new PrismaClient()

export async function GET() {
  // 随机取0-136之间的数据，包含0和136
  const id = Math.floor(Math.random() * 80)

  console.log('id', id)

  const doo =  await prisma.loveDoCard.findUnique({
    where: { id }
  })
  // 随机取0-136之间的数据，包含0和136
  const id2 = Math.floor(Math.random() * 20)

  const who =  await prisma.loveWhoCard.findUnique({
    where: { id: id2 }
  })

  return NextResponse.json({ message: '获取成功', data: {
    do: doo,
    who: who
  }, code: 0 }, { status: 200 });
}